$(document).ready(function () {
    Car_boat.onload();
})

var Car_boat = (function () {

    var init = function () {
		$(window).resize(function(){
//			Car_boat.windowResize()
		});
    }

    return {
        onload : function () {
            init();
//          Car_boat.windowResize()
            Car_boat.formTab();
            Car_boat.tableDataCar();
        },
         /*页面大小计算*/
//      windowResize:function(){
//       	var content_xxcj_h=$(document).height()-20;
//			$(".wxl_wrap").css("height",content_xxcj_h+"px");
//		},
        /*tab选项卡*/
       formTab:function(){
	       	$(".wxl_fcys_tab span").click(function(){
	       		$(this).addClass("active").siblings("span").removeClass("active");
				var n=$(this).index();
				$(".wxl_carBoat_con>.wxl_table_box").eq(n).show().siblings(".wxl_table_box").hide();
				if(n=0){
					if ($.fn.dataTable.isDataTable('#wxlCarsInfo')) {
                        var table = $('#wxlCarsInfo').DataTable();
                       return 
                    }else{
                    	Car_boat.tableDataCar();
                    }

				}else if(n=1){
					if ($.fn.dataTable.isDataTable('#wxlBoatsInfo')) {
                        var table = $('#wxlBoatsInfo').DataTable();
                       return 
                    }else{
                    	Car_boat.tableDataBoat();
                    }
				}
			})
       },
        /*table表格数据车辆*/
	    tableDataCar:function(){
	    	var data = [{
	 				"carNum": "1",
	 				"carCode": "2",
	 				"carType": "3",
	 				"Suborders": "4",
	 				"brandModel": "5",
	 				"xZdivisions": "6",
	 				"carAddress": "7",
	 				"zgTaxsuo": "主管",
	 				"filingTime": "8",
	 				"jiaoKTime": "9",
	 				"engineNum": "10",
	 				"invoiceDate": "11",
	 				"useNature": "12",
	 				"fuelType": "13",
	 				"exhaustVolume": "14",
	 				"passenger": "15",
	 				"quality": "16",
	 				"logoutDate": "17",
	 				"remarks": "18",
	 				"operation": null
	 			},
	 			{
	 				"carNum": "1",
	 				"carCode": "2",
	 				"carType": "3",
	 				"Suborders": "4",
	 				"brandModel": "5",
	 				"xZdivisions": "6",
	 				"carAddress": "7",
	 				"zgTaxsuo": "主管",
	 				"filingTime": "8",
	 				"jiaoKTime": "9",
	 				"engineNum": "10",
	 				"invoiceDate": "11",
	 				"useNature": "12",
	 				"fuelType": "13",
	 				"exhaustVolume": "14",
	 				"passenger": "15",
	 				"quality": "16",
	 				"logoutDate": "17",
	 				"remarks": "18",
	 				"operation": null
	 			},
	 			{
	 				"carNum": "1",
	 				"carCode": "2",
	 				"carType": "3",
	 				"Suborders": "4",
	 				"brandModel": "5",
	 				"xZdivisions": "6",
	 				"carAddress": "7",
	 				"zgTaxsuo": "主管",
	 				"filingTime": "8",
	 				"jiaoKTime": "9",
	 				"engineNum": "10",
	 				"invoiceDate": "11",
	 				"useNature": "12",
	 				"fuelType": "13",
	 				"exhaustVolume": "14",
	 				"passenger": "15",
	 				"quality": "16",
	 				"logoutDate": "17",
	 				"remarks": "18",
	 				"operation": null
	 			},
	 			{
	 				"carNum": "1",
	 				"carCode": "2",
	 				"carType": "3",
	 				"Suborders": "4",
	 				"brandModel": "5",
	 				"xZdivisions": "6",
	 				"carAddress": "7",
	 				"zgTaxsuo": "主管",
	 				"filingTime": "8",
	 				"jiaoKTime": "9",
	 				"engineNum": "10",
	 				"invoiceDate": "11",
	 				"useNature": "12",
	 				"fuelType": "13",
	 				"exhaustVolume": "14",
	 				"passenger": "15",
	 				"quality": "16",
	 				"logoutDate": "17",
	 				"remarks": "18",
	 				"operation": null
	 			},
	 			{
	 				"carNum": "1",
	 				"carCode": "2",
	 				"carType": "3",
	 				"Suborders": "4",
	 				"brandModel": "5",
	 				"xZdivisions": "6",
	 				"carAddress": "7",
	 				"zgTaxsuo": "主管",
	 				"filingTime": "8",
	 				"jiaoKTime": "9",
	 				"engineNum": "10",
	 				"invoiceDate": "11",
	 				"useNature": "12",
	 				"fuelType": "13",
	 				"exhaustVolume": "14",
	 				"passenger": "15",
	 				"quality": "16",
	 				"logoutDate": "17",
	 				"remarks": "18",
	 				"operation": null
	 			},
	 			{
	 				"carNum": "1",
	 				"carCode": "2",
	 				"carType": "3",
	 				"Suborders": "4",
	 				"brandModel": "5",
	 				"xZdivisions": "6",
	 				"carAddress": "7",
	 				"zgTaxsuo": "主管",
	 				"filingTime": "8",
	 				"jiaoKTime": "9",
	 				"engineNum": "10",
	 				"invoiceDate": "11",
	 				"useNature": "12",
	 				"fuelType": "13",
	 				"exhaustVolume": "14",
	 				"passenger": "15",
	 				"quality": "16",
	 				"logoutDate": "17",
	 				"remarks": "18",
	 				"operation": null
	 			},
	 			{
	 				"carNum": "1",
	 				"carCode": "2",
	 				"carType": "3",
	 				"Suborders": "4",
	 				"brandModel": "5",
	 				"xZdivisions": "6",
	 				"carAddress": "7",
	 				"zgTaxsuo": "主管",
	 				"filingTime": "8",
	 				"jiaoKTime": "9",
	 				"engineNum": "10",
	 				"invoiceDate": "11",
	 				"useNature": "12",
	 				"fuelType": "13",
	 				"exhaustVolume": "14",
	 				"passenger": "15",
	 				"quality": "16",
	 				"logoutDate": "17",
	 				"remarks": "18",
	 				"operation": null
	 			},
	 			{
	 				"carNum": "1",
	 				"carCode": "2",
	 				"carType": "3",
	 				"Suborders": "4",
	 				"brandModel": "5",
	 				"xZdivisions": "6",
	 				"carAddress": "7",
	 				"zgTaxsuo": "主管",
	 				"filingTime": "8",
	 				"jiaoKTime": "9",
	 				"engineNum": "10",
	 				"invoiceDate": "11",
	 				"useNature": "12",
	 				"fuelType": "13",
	 				"exhaustVolume": "14",
	 				"passenger": "15",
	 				"quality": "16",
	 				"logoutDate": "17",
	 				"remarks": "18",
	 				"operation": null
	 			},
	 			{
	 				"carNum": "1",
	 				"carCode": "2",
	 				"carType": "3",
	 				"Suborders": "4",
	 				"brandModel": "5",
	 				"xZdivisions": "6",
	 				"carAddress": "7",
	 				"zgTaxsuo": "主管",
	 				"filingTime": "8",
	 				"jiaoKTime": "9",
	 				"engineNum": "10",
	 				"invoiceDate": "11",
	 				"useNature": "12",
	 				"fuelType": "13",
	 				"exhaustVolume": "14",
	 				"passenger": "15",
	 				"quality": "16",
	 				"logoutDate": "17",
	 				"remarks": "18",
	 				"operation": null
	 			},
	 			{
	 				"carNum": "1",
	 				"carCode": "2",
	 				"carType": "3",
	 				"Suborders": "4",
	 				"brandModel": "5",
	 				"xZdivisions": "6",
	 				"carAddress": "7",
	 				"zgTaxsuo": "主管",
	 				"filingTime": "8",
	 				"jiaoKTime": "9",
	 				"engineNum": "10",
	 				"invoiceDate": "11",
	 				"useNature": "12",
	 				"fuelType": "13",
	 				"exhaustVolume": "14",
	 				"passenger": "15",
	 				"quality": "16",
	 				"logoutDate": "17",
	 				"remarks": "18",
	 				"operation": null
	 			},
	 			{
	 				"carNum": "1",
	 				"carCode": "2",
	 				"carType": "3",
	 				"Suborders": "4",
	 				"brandModel": "5",
	 				"xZdivisions": "6",
	 				"carAddress": "7",
	 				"zgTaxsuo": "主管",
	 				"filingTime": "8",
	 				"jiaoKTime": "9",
	 				"engineNum": "10",
	 				"invoiceDate": "11",
	 				"useNature": "12",
	 				"fuelType": "13",
	 				"exhaustVolume": "14",
	 				"passenger": "15",
	 				"quality": "16",
	 				"logoutDate": "17",
	 				"remarks": "18",
	 				"operation": null
	 			}
	 		];
	 		$('#wxlCarsInfo').removeAttr('width').DataTable({
	 			"data": data,
	 			"columnDefs": [{
	 					"targets": -1,
	 					"data": null,
	 					"render": function(data, type, full, meta) {
	 						return '<a href="car_form_bg.html"><span class="btn wxl_bg_yel wxl_btn_bg">变更</span></a>'
	 					}
	 				},
	 				{
	 					'targets': 0,
	 					'className': 'dt-body-center',
	 					'render': function(data, type, row) {
	 						return '<input class="checkchild" type="checkbox"/>';
	 					}
	 				}
	 			],
	 			"columns": [
	 			    { "data": "btn" }, 
	 			    { "data": "carNum"},
				    {"data": "carCode"},
				    {"data": "carType"},
				    {"data": "Suborders"},
				    {"data": "brandModel"},
				    {"data": "xZdivisions" },
				    {"data": "carAddress"},
				     {"data": "zgTaxsuo"},
				    {"data": "filingTime"},
				    {"data": "jiaoKTime"},
				    {"data": "engineNum"},
				    {"data": "invoiceDate" },
				    {"data": "useNature"},
				    {"data": "fuelType"},
				    { "data": "exhaustVolume"},
				    {"data": "passenger"},
				    {"data": "quality"},
				    {"data": "logoutDate"},
				    {"data": "remarks"},
				    {"data": "operation"}
	 			],
	 			"info": false,
	 			"lengthChange": false,
	 			"searching": false,
				'scrollX':   true,
				'scrollCollapse': true,
				'fixedColumns':   {
					leftColumns: 1
				}
	 		})
	 		var th_width=$(".DTFC_LeftHeadWrapper tr").outerWidth();
	 		$(".DTFC_LeftBodyLiner table").css("width",th_width+"px")
	 		$(".DTFC_LeftBodyWrapper").css("border-right","1px solid #e2e2e2")
	 		$(".DTFC_LeftHeadWrapper tr").click(function(){
	 			$(".DTFC_LeftBodyLiner").css("width",th_width+"px")
	 		})
	    },
	     /*table表格数据船舶*/
	    tableDataBoat:function(){
	    	var data = [{
	 				"boatNum": "1",
	 				"boatCode": "2",
	 				"boatType": "3",
	 				"boatSuborders": "4",
	 				"boatChinaName": "5",
	 				"xZdivision":"6",
	 				"boatAddress": "7",
	 				"zgTaxsuo": "主管",
	 				"filingTime": "8",
	 				"jiaoKTime": "9",
	 				"taxTerm": "10",
	 				"resignNUm": "11",
	 				"boatPort": "12",
	 				"issueDate": "13",
	 				"ownershipDate": "14",
	 				"completeDate": "15",
	 				"netPosition": "16",
	 				"monitorRate": "17",
	 				"boatLength": "18",
	 				"logoutDate": "19",
	 				"remarks": "20",
	 				"operation": null
	 			},
	 			{
	 				"boatNum": "1",
	 				"boatCode": "2",
	 				"boatType": "3",
	 				"boatSuborders": "4",
	 				"boatChinaName": "5",
	 				"xZdivision": "6",
	 				"boatAddress": "7",
	 				"zgTaxsuo": "主管",
	 				"filingTime": "8",
	 				"jiaoKTime": "9",
	 				"taxTerm": "10",
	 				"resignNUm": "11",
	 				"boatPort": "12",
	 				"issueDate": "13",
	 				"ownershipDate": "14",
	 				"completeDate": "15",
	 				"netPosition": "16",
	 				"monitorRate": "17",
	 				"boatLength": "18",
	 				"logoutDate": "19",
	 				"remarks": "20",
	 				"operation": null
	 			},
	 			{
	 				"boatNum": "1",
	 				"boatCode": "2",
	 				"boatType": "3",
	 				"boatSuborders": "4",
	 				"boatChinaName": "5",
	 				"xZdivision": "6",
	 				"boatAddress": "7",
	 				"zgTaxsuo": "主管",
	 				"filingTime": "8",
	 				"jiaoKTime": "9",
	 				"taxTerm": "10",
	 				"resignNUm": "11",
	 				"boatPort": "12",
	 				"issueDate": "12",
	 				"ownershipDate": "14",
	 				"completeDate": "15",
	 				"netPosition": "16",
	 				"monitorRate": "17",
	 				"boatLength": "18",
	 				"logoutDate": "19",
	 				"remarks": "20",
	 				"operation": null
	 			}
	 		];
	 		$('#wxlBoatsInfo').removeAttr('width').DataTable({
	 			"data": data,
	 			"columnDefs": [{
	 					"targets": -1,
	 					"data": null,
	 					"render": function(data, type, full, meta) {
	 						return '<a href="boat_form_bg.html"><span class="btn wxl_bg_yel wxl_btn_bg">变更</span></a>'
	 					}
	 				},
	 				{
	 					'targets': 0,
	 					'className': 'dt-body-center',
	 					'render': function(data, type, row) {
	 						return '<input class="checkchild" type="checkbox"/>';
	 					}
	 				}
	 			],
	 			"columns": [
	 			    { "data": "btn" }, 
	 			    { "data": "boatNum"},
				    {"data": "boatCode"},
				    {"data": "boatType"},
				    {"data": "boatSuborders"},
				    {"data": "boatChinaName" },
				    {"data": "xZdivision"},
				    {"data": "boatAddress"},
				    {"data": "zgTaxsuo"},
				    {"data": "filingTime"},
				    {"data": "jiaoKTime"},
				    {"data": "taxTerm"},
				    {"data": "resignNUm" },
				    {"data": "boatPort"},
				    {"data": "issueDate"},
				    { "data": "ownershipDate"},
				    {"data": "completeDate"},
				    {"data": "netPosition"},
				    {"data": "monitorRate"},
				    {"data": "boatLength"},
				    {"data": "logoutDate"}, 
				    {"data": "remarks"},
				    {"data": "operation"}
	 			],
	 			"info": false,
	 			"lengthChange": false,
	 			"searching": false,
	 			'scrollX':   true,
				'fixedColumns':   {
					leftColumns: 1
				}
	 		})
	 		var th_width=$(".DTFC_LeftHeadWrapper th").outerWidth();
	 		$(".DTFC_LeftBodyLiner table,.DTFC_LeftBodyWrappe").css("width",th_width+"px")
	 		$(".DTFC_LeftBodyWrapper").css("border-right","1px solid #e2e2e2")
	 		$(".DTFC_LeftHeadWrapper tr").click(function(){
	 			$(".DTFC_LeftBodyLiner").css("width",th_width+"px")
	 		})
	    },
    }
})();
